package at.catalysts.imgClassifier.core;

import java.io.File;

import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;

import at.catalysts.imgClassifier.dataFinders.TextReader;
import at.jaki.ubb.crawling.api.CrawlingEngine;
import at.jaki.ubb.crawling.core.CrawlingEngineImpl;
import at.jaki.ubb.crawling.model.Target;

public class CoreImg {

	private static final Logger LOG = Logger.getLogger(CoreImg.class);

	/**
	 * log4j config file location
	 */
	public static final String LOG4J = "config" + File.separatorChar
			+ "log4j.xml";

	/**
	 * Will initialize log4J
	 */
	private static void initLog4j() {
		String log4j = LOG4J;
		DOMConfigurator.configure(log4j);
		LOG.info("Loaded log configuration from " + log4j);
	}

	public static void main(String[] args) {
		initLog4j();
		CoreImg core = new CoreImg();
		core.start();
	}

	public void start() {
		initEngineAndUi();
	}

	private void initEngineAndUi() {
		CrawlingEngine ce = new CrawlingEngineImpl();
		
		ce.start(ConfigGenerator.createMainConfig());
		
		Target<String> t = new Target<String>(1D, "1", TextReader.INPUT_TYPE_TEXT, "input/first.txt");
		ce.addTarget(t);
		
	}

}
